/*
 * Copyright 2008 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.ccsoft.mc.core;

import java.util.List;
import java.util.Set;

import org.ccsoft.mc.core.impl.BaseCache;

/**
 * 
 * @author chaocai
 *
 *The context of the current container instance
 */
public interface ServiceContext {
	/**
	 * get the service instance by component name 
	 * @param name component name
	 * @return 
	 */
	public Object getServiceByName(String name);
	/**
	 * get the service instance by service type 
	 * @param type service type
	 * @return
	 */
	public Object getServiceByType(String type);
	/**
	 * get the service instance by service type and component name
	 * @param type service type
	 * @param name component name
	 * @return
	 */
	public Object getServiceByType(String type,String name);
	/**
	 * get the all the service instance by service type
	 * @param type serviceType
	 * @return 
	 */
	public List getServicesByType(String type);
	/**
	 * register the ServiceChangeListener instance to the context
	 * @param listener
	 */
	public void registerServiceChangeListener(ServiceChangeListener listener);
	/**
	 * get the ServiceBundle objects can not be resolved for not all dependent service can be find 
	 * @return
	 */
	public Set<ServiceBundle> getUnResolvingServiceBundles();
	/**
	 * get the ServiceBundle objects already be resolved
	 * @return
	 */
	public Set<ServiceBundle> getReadyServiceBundles();
	/**
	 * get the cache using for storing the unresolving ServiceBundle objects
	 * @return
	 */
	public BaseCache getUnResolvingServiceCache();
	/**
	 * get the cache using for storing the ready ServiceBundle objects
	 * @return
	 */
	public BaseCache getReadyServiceCache();
	/**
	 * remove the ServiceBundle with the spec name
	 * @param name
	 */
	public void removeReadyServiceBundle(String name);
}
